package cn.sixmillions.yuqueblog.controller;

import cn.sixmillions.yuqueblog.utils.RedisUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 缓存操作
 * @author: sixmillions
 * @since: 2021/12/12
 **/
@RestController
@RequestMapping("/api/cache")
@Api(value = "Cache", tags = "缓存")
public class CacheController {

    @GetMapping("/delete-by-prefix")
    @ApiOperation(value = "根据缓存key的前缀删除", notes = "返回删除的缓存数量")
    public long deleteByPrefix(String prefix) {
        return RedisUtil.KeyOps.deleteByPrefix(prefix);
    }
}
